*Note Serbia and Yugoslavia change, per Gleditch and Ward update, 2008
* create a stateid variable based on Gleditsch and Ward (1999)
gen str3 stateid="xxx"

replace stateid ="USA" if country=="United States"
replace stateid ="USA" if country=="United States of America"
replace stateid ="USA" if country=="USA"
replace stateid ="USA" if country=="US"
replace stateid ="CAN" if country=="Canada"
replace stateid ="HAI" if country=="Haiti"
replace stateid ="DOM" if country=="Dominican Republic"
replace stateid ="DOM" if country=="Dom. Rep."
replace stateid ="JAM" if country=="Jamaica"
replace stateid ="TRI" if country=="Trinidad & Tobago"
replace stateid ="TRI" if country=="Trinidad &Tobago"
replace stateid ="TRI" if country=="Trinidad and Tobago"
replace stateid ="TRI" if country=="Trinidad"
replace stateid ="TRI" if country=="Trinidad-Tobago"
replace stateid ="BAR" if country=="Barbados"
replace stateid ="MEX" if country=="Mexico"
replace stateid ="GUA" if country=="Guatemala"
replace stateid ="HON" if country=="Honduras"
replace stateid ="SAL" if country=="El Salvador"
replace stateid ="NIC" if country=="Nicaragua"
replace stateid ="COS" if country=="Costa Rica"
replace stateid ="PAN" if country=="Panama"
replace stateid ="COL" if country=="Colombia"
replace stateid ="COL" if country=="Columbia"
replace stateid ="VEN" if country=="Venezuela"
replace stateid ="VEN" if country=="Venezuela, RB"
replace stateid ="ECU" if country=="Ecuador"
replace stateid ="PER" if country=="Peru"
replace stateid ="BRA" if country=="Brazil"
replace stateid ="BOL" if country=="Bolivia"
replace stateid ="CHL" if country=="Chile"
replace stateid ="ARG" if country=="Argentina"
replace stateid ="URU" if country=="Uruguay"
replace stateid ="UKG" if country=="United Kingdom"
replace stateid ="UKG" if country=="UK"
replace stateid ="IRE" if country=="Ireland"
replace stateid ="NTH" if country=="Netherlands"
replace stateid ="BEL" if country=="Belgium"
replace stateid ="LUX" if country=="Luxembourg"
replace stateid ="FRN" if country=="France"
replace stateid ="SWZ" if country=="Switzerland"
replace stateid ="SPN" if country=="Spain"
replace stateid ="POR" if country=="Portugal"
replace stateid ="GFR" if country=="West Germany"
replace stateid ="GFR" if country=="FRG/Germany"
replace stateid ="GFR" if country=="GFR"
replace stateid ="GFR" if country=="Germany (post re-unification)"
replace stateid ="GDR" if country=="German Democratic Republic"
replace stateid ="GDR" if country=="East Germany"
replace stateid ="GDR" if country=="GDR"
replace stateid ="POL" if country=="Poland"
replace stateid ="AUS" if country=="Austria"
replace stateid ="HUN" if country=="Hungary"
replace stateid ="ITA" if country=="Italy"
replace stateid ="MLT" if country=="Malta"
replace stateid ="SER" if country=="Yugoslavia"
replace stateid ="SER" if country=="Yugoslavia (Serbia)"
replace stateid ="SER" if country=="Serbia (Yugoslavia)"
replace stateid ="SER" if country=="Yugoslavia/Serbia"
replace stateid ="SER" if country=="Serbia"
*replace stateid ="SER" if country=="Serbia and Montenegro" & year>2002
replace stateid ="SER" if country=="Serbia-Montenegro" 
replace stateid ="SER" if country=="Yugoslavia (Socialist Rep)"
replace stateid ="SER" if country=="Yugoslavia (Serbia-Montenegro)"
*replace stateid ="MNG" if country=="Montenegro" & year>2005
replace stateid ="GRC" if country=="Greece"
replace stateid ="FIN" if country=="Finland"
replace stateid ="SWD" if country=="Sweden"
replace stateid ="NOR" if country=="Norway"
replace stateid ="DEN" if country=="Denmark"
replace stateid ="MLI" if country=="Mali"
replace stateid ="CDI" if country=="Ivory Coast"
replace stateid ="CDI" if country=="Cote d'Ivoire"
replace stateid ="CDI" if country=="Cote D'Ivoire"
replace stateid ="LBR" if country=="Liberia"
replace stateid ="SIE" if country=="Sierre Leone"
replace stateid ="GHA" if country=="Ghana"
replace stateid ="TOG" if country=="Togo"
replace stateid ="CAO" if country=="Cameroon"
replace stateid ="NIG" if country=="Nigeria"
replace stateid ="GAB" if country=="Gabon"
replace stateid ="CEN" if country=="Central African Republic"
replace stateid ="CEN" if country=="Cent. African Rep."
replace stateid ="CEN" if country=="Cent. Af. Rep."
replace stateid ="CHA" if country=="Chad"
replace stateid ="CON" if country=="Congo"
replace stateid ="CON" if country=="Congo (Republic of Congo)"
replace stateid ="CON" if country=="Congo, Republic of"
replace stateid ="CON" if country=="Republic of Congo"
replace stateid ="CON" if country=="Congo (Brazzaville)"
*replace stateid ="CON" if ccode==484
replace stateid ="DRC" if country=="Zaire"
replace stateid ="DRC" if country=="Democratic Republic of Congo"
replace stateid ="DRC" if country=="Congo, Dem. Rep. (Zaire)"
replace stateid ="DRC" if country=="Congo, Dem. Rep."
replace stateid ="DRC" if country=="Congo, DR"
replace stateid ="DRC" if country=="Congo, Democratic Republic of (Zaire)"
replace stateid ="DRC" if country=="Congo, Democratic Republic of"
replace stateid ="DRC" if country=="Congo, Democratic Republic"
replace stateid ="DRC" if country=="Democratic Republic of the Congo"
replace stateid ="DRC" if country=="Zaire (Democ Republic Congo)"
replace stateid ="DRC" if country=="Congo (DRC)"
replace stateid ="KEN" if country=="Kenya"
replace stateid ="TAZ" if country=="Tanzania"
replace stateid ="TAZ" if country=="United Republic of Tanzania"
replace stateid ="TAZ" if country=="Tanzania/Tanganyika"
replace stateid ="ZAM" if country=="Zambia"
replace stateid ="ZIM" if country=="Zimbabwe"
replace stateid ="ZIM" if country=="Zimbabwe (Rhodesia)"
replace stateid ="MAW" if country=="Malawi"
replace stateid ="SAF" if country=="South Africa"
replace stateid ="SAF" if country=="S. Africa"
replace stateid ="LES" if country=="Lesotho"
replace stateid ="BOT" if country=="Botswana"
replace stateid ="ALG" if country=="Algeria"
replace stateid ="TUN" if country=="Tunisia"
replace stateid ="LIB" if country=="Libya"
replace stateid ="SUD" if country=="Sudan"
replace stateid ="IRN" if country=="Iran"
replace stateid ="IRN" if country=="Iran "
replace stateid ="IRN" if country=="Iran, Islamic Rep."
replace stateid ="TUR" if country=="Turkey"
replace stateid ="IRQ" if country=="Iraq"
replace stateid ="EGY" if country=="Egypt"
replace stateid ="EGY" if country=="Egypt, Arab Rep."
replace stateid ="SYR" if country=="Syria"
replace stateid ="SYR" if country=="Syrian Arab Republic"
replace stateid ="LEB" if country=="Lebanon"
replace stateid ="JOR" if country=="Jordan"
replace stateid ="ISR" if country=="Israel"
replace stateid ="SAU" if country=="Saudi Arabia"
replace stateid ="KUW" if country=="Kuwait"
replace stateid ="TAW" if country=="Taiwan"
replace stateid ="ROK" if country=="South Korea"
replace stateid ="ROK" if country=="ROK"
replace stateid ="ROK" if country=="Korea, Rep."
replace stateid ="JPN" if country=="Japan"
replace stateid ="IND" if country=="India"
replace stateid ="PAK" if country=="Pakistan"
replace stateid ="SRI" if country=="Sri Lanka"
replace stateid ="SRI" if country=="Sri Lanka (Ceylon)"
replace stateid ="NEP" if country=="Nepal"
replace stateid ="THI" if country=="Thailand"
replace stateid ="RVN" if country=="South Vietnam"
replace stateid ="RVN" if country=="Republic of Vietnam"
replace stateid ="RVN" if country=="Vietnam South"
replace stateid ="DRV" if country=="Vietnam North"
replace stateid ="RVN" if country=="Vietnam, South"
replace stateid ="DRV" if country=="Vietnam, North"
replace stateid ="MAL" if country=="Malaysia"
replace stateid ="SIN" if country=="Singapore"
replace stateid ="PHI" if country=="Philippines"
replace stateid ="INS" if country=="Indonesia"
replace stateid ="AUL" if country=="Australia"
replace stateid ="NEW" if country=="New Zealand"

replace stateid ="ALB" if country=="Albania"
replace stateid ="ANG" if country=="Angola"
replace stateid ="AAB" if country=="Antigua and Barbuda"
replace stateid ="AAB" if country=="Antigua & Barbuda"

replace stateid ="ARM" if country=="Armenia"
replace stateid ="AZE" if country=="Azerbaijan"
replace stateid ="BNG" if country=="Bangladesh"
replace stateid ="BLR" if country=="Belarus"
replace stateid ="BLZ" if country=="Belize"
replace stateid ="BEN" if country=="Benin"
replace stateid ="BHU" if country=="Bhutan"
replace stateid ="BUL" if country=="Bulgaria"
replace stateid ="BFO" if country=="Burkina Faso"
replace stateid ="BFO" if country=="Burkina Faso "
replace stateid ="MYA" if country=="Burma"
replace stateid ="BUI" if country=="Burundi"
replace stateid ="CAM" if country=="Cambodia"
replace stateid ="CAP" if country=="Cape Verde"
replace stateid ="CAP" if country=="C. Verde Is."
replace stateid ="CAP" if country=="Cabo Verde" 
replace stateid ="CHN" if country=="China"
replace stateid ="CHN" if country=="PRC"
replace stateid ="COM" if country=="Comoros"
replace stateid ="COM" if country=="Comoros Is."
replace stateid ="COM" if country=="Comoro Is."
replace stateid ="DRC" if country=="Congo (Zaire)"
replace stateid ="DRC" if country=="Congo (Kinshasa)"
replace stateid ="DRC" if country=="Congo-Kinshasa"

replace stateid ="DRC" if country=="Democratic Republic of the Congo"
replace stateid ="CON" if country=="Congo (Brazzaville)"
replace stateid ="CON" if country=="Congo ( Brazzaville)"
replace stateid ="CON" if country=="Congo-Brazzaville"

replace stateid ="CON" if country=="Congo Brazzaville"

replace stateid ="CDI" if country=="Cote d'Ivoire"
replace stateid ="CDI" if country=="Cote d�Ivoire"

replace stateid ="CDI" if country=="Cote d`Ivoire"
replace stateid ="CDI" if country=="Cote d Ivoire"
replace stateid ="CDI" if country=="Cote D'Ivoire"
replace stateid ="CRO" if country=="Croatia"
replace stateid ="CUB" if country=="Cuba"
replace stateid ="CYP" if country=="Cyprus"
replace stateid ="CZR" if country=="Czech Republic"
replace stateid ="CZR" if country=="Czech Rep."
replace stateid ="DJI" if country=="Djibouti"
replace stateid ="DMA" if country=="Dominica"
replace stateid ="EQG" if country=="Equatorial Guinea"
replace stateid ="EQG" if country=="Eq. Guinea"
replace stateid ="ERI" if country=="Eritrea"
replace stateid ="EST" if country=="Estonia"
replace stateid ="ETH" if country=="Ethiopia"
replace stateid ="ETH" if country=="Ethiopia (Eritrea split)"
replace stateid ="ETH" if country=="Ethiopia (incl. Eritrea)"

replace stateid ="FJI" if country=="Fiji"
replace stateid ="GAM" if country=="Gambia"
replace stateid ="GAM" if country=="Gambia, The"
replace stateid ="GRG" if country=="Georgia"
replace stateid ="GRN" if country=="Grenada"
replace stateid ="GUI" if country=="Guinea"
replace stateid ="GNB" if country=="Guinea-Bissau"
replace stateid ="GNB" if country=="Guinea Bissau"
replace stateid ="GUY" if country=="Guyana"
replace stateid ="KZK" if country=="Kazakhstan"
replace stateid ="KBI" if country=="Kiribati"
replace stateid ="ROK" if country=="Korea, Republic of"
replace stateid ="ROK" if country=="South Korea"
replace stateid ="PRK" if country=="North Korea"
replace stateid ="PRK" if country=="NKorea"
replace stateid ="PRK" if country=="Korea, North"

replace stateid ="KYR" if country=="Kyrgyzstan"
replace stateid ="KYR" if country=="Kyrgystan"
replace stateid ="KYR" if country=="Kyrgyz Republic"
replace stateid ="LAO" if country=="Laos"
replace stateid ="LAO" if country=="Lao PDR"
replace stateid ="LAT" if country=="Latvia"
replace stateid ="LIT" if country=="Lithuania"
replace stateid ="LIE" if country=="Liechtenstein"
replace stateid ="MAC" if country=="Macedonia"
replace stateid ="MAC" if country=="Macedonia, FYR"
replace stateid ="MAD" if country=="Maldives"
replace stateid ="MSI" if country=="Marshall Islands"
replace stateid ="MAA" if country=="Mauritania"
replace stateid ="MAS" if country=="Mauritius"
replace stateid ="FSM" if country=="Micronesia"
replace stateid ="FSM" if country=="Micronesia, Federated States"
replace stateid ="MLD" if country=="Moldova"
replace stateid ="MLD" if country=="Republic of Moldova"
replace stateid ="MNC" if country=="Monaco"
replace stateid ="MON" if country=="Mongolia"
replace stateid ="MOR" if country=="Morocco"
replace stateid ="MZM" if country=="Mozambique"
replace stateid ="NAU" if country=="Nauru"
replace stateid ="NAM" if country=="Namibia"
replace stateid ="NIR" if country=="Niger"
replace stateid ="PAL" if country=="Palau"
replace stateid ="PAR" if country=="Paraguay"
replace stateid ="RUM" if country=="Romania"
replace stateid ="RUM" if country=="Rumania"

replace stateid ="RUS" if country=="Russia"
replace stateid ="RUS" if country=="USSR/Russia"

replace stateid ="RWA" if country=="Rwanda"
replace stateid ="WSM" if country=="Samoa"
replace stateid ="STP" if country=="Sao Tome and Principe"
replace stateid ="STP" if country=="Sao Tome"

replace stateid ="SNM" if country=="San Marino"
replace stateid ="WSM" if country=="W. Samoa"

replace stateid ="KYR" if country=="Saudia Arabia"
replace stateid ="SEN" if country=="Senegal"
replace stateid ="SEY" if country=="Seychelles"
replace stateid ="SIE" if country=="Sierra Leone"
replace stateid ="SLO" if country=="Slovakia"
replace stateid ="SLV" if country=="Slovenia"
replace stateid ="SOL" if country=="Solomon Islands"
replace stateid ="SOM" if country=="Somalia"
replace stateid ="SKN" if country=="St. Kitts and Nevis"
replace stateid ="SKN" if country=="Saint Kitts & Nevis"
replace stateid ="SKN" if country=="Saint Kitts and Nevis"
replace stateid ="SKN" if country=="St.Kitts"

replace stateid ="SLU" if country=="St. Lucia"
replace stateid ="SLU" if country=="St.Lucia"
replace stateid ="SLU" if country=="Saint Lucia"
replace stateid ="SVG" if country=="St. Vincent and the Grenadines"
replace stateid ="SVG" if country=="Saint Vincent and The Grenadines"
replace stateid ="SVG" if country=="Saint Vincent & the Grenadines"

replace stateid ="SVG" if country=="St.Vincent"
replace stateid ="SVG" if country=="St. Vincent"
replace stateid ="SUR" if country=="Surinam"
replace stateid ="SUR" if country=="Suriname"
replace stateid ="SWA" if country=="Swaziland"
replace stateid ="TAJ" if country=="Tajikistan"
replace stateid ="TON" if country=="Tonga"
replace stateid ="TUV" if country=="Tuvalu"

replace stateid ="TKM" if country=="Turkmenistan"
replace stateid ="UGA" if country=="Uganda"
replace stateid ="UKR" if country=="Ukraine"
replace stateid ="UZB" if country=="Uzbekistan"
replace stateid ="VAN" if country=="Vanuatu"
replace stateid ="RVN" if country=="Vietnam, Republic of"
replace stateid ="DRV" if country=="Vietnam, Socialist Republic of"
replace stateid ="YEM" if country=="Yemen"
replace stateid ="YPR" if country=="Yemen, South"
replace stateid ="YPR" if country=="Democratic Yemen"

replace stateid ="YPR" if country=="People's Republic of Yemen (South Yemen)"
replace stateid ="YPR" if country=="People's Republic of Yemen"

replace stateid ="YPR" if country=="Yemen PR"
replace stateid ="YPR" if country=="Yemen South"
replace stateid ="YEM" if country=="Yemen North"
replace stateid ="YEM" if country=="Yemen, North"

replace stateid ="YEM" if country=="Yemen (North)"

replace stateid ="YEM" if country=="North Yemen"
replace stateid ="YEM" if country=="Arab Republic of Yemen (North Yemen)"
replace stateid ="YPR" if country=="South Yemen"
replace stateid ="BHM" if country=="Bahamas"
replace stateid ="BAH" if country=="Bahrain"
replace stateid ="BRU" if country=="Brunei"
replace stateid ="BRU" if country=="Brunei Darussalam"
replace stateid ="CZE" if country=="Czechoslovakia"
*replace stateid ="CZE" if country=="Czech Republic" & year<1993
replace stateid ="GFR" if country=="Germany, FR"
replace stateid ="GFR" if country=="German Federal Republic"

*Germany since 1990 is often refered to as Germany but is still GFR according to Gleditsch and Ward
*replace stateid ="GFR" if country=="Germany" & year>1989
replace stateid ="GFR" if country=="Germany"
replace stateid ="GDR" if country=="Germany, DR"
replace stateid ="GDR" if country=="Germany, E. "
replace stateid ="GFR" if country=="Germany, W."
replace stateid ="" if country=="Hong Kong"
replace stateid ="ICE" if country=="Iceland"
replace stateid ="MYA" if country=="Myanmar"
replace stateid ="" if country=="New Caledonia"
replace stateid ="OMA" if country=="Oman"
replace stateid ="PNG" if country=="Papua New Guinea"
replace stateid ="PNG" if country=="P. N. Guinea"
replace stateid ="SOL" if country=="Solomon Is."
replace stateid ="BOS" if country=="Bosnia-Herz"
replace stateid ="BOS" if country=="Bosnia-Herzegovina"
replace stateid ="BOS" if country=="Bosnia and Herzegovina"
replace stateid ="BOS" if country=="Bosnia & Herzegovina"
replace stateid ="BOS" if country=="Bosnia"
replace stateid ="QAT" if country=="Qatar"
replace stateid ="RUS" if country=="Russian Federation"
replace stateid ="UAE" if country=="UAE"
replace stateid ="UAE" if country=="United Arab Emirates"
replace stateid ="UAE" if country=="United Arab Em."

replace stateid ="RUS" if country=="USSR"
replace stateid ="RUS" if country=="Soviet Union"
replace stateid ="DRV" if country=="Vietnam"
replace stateid ="DRV" if country=="Democratic Republic of Vietnam"
replace stateid ="DRV" if country=="Vietnam, Democratic Republic"
replace stateid ="YPR" if country=="Yemen, PDR"
replace stateid ="YPR" if country=="Yemen (PDR)"
replace stateid ="YEM" if country=="Yemen, Rep."
replace stateid ="YEM" if country=="Yemen, Arab Rep."
replace stateid ="YEM" if country=="Yemen, Arab Republic (North)"
replace stateid ="YEM" if country=="Yemen Arab Republic (North)"
replace stateid ="YEM" if country=="Yemen Arab Republic"
replace stateid ="YEM" if country=="Yemen (AR)"
replace stateid ="YEM" if country=="Yemen, Arab Republic of"
replace stateid ="ROK" if country=="Korea, Republic"
replace stateid ="ROK" if country=="Republic of Korea"

replace stateid ="ROK" if country=="Korea Rep."
replace stateid ="ROK" if country=="Republic of Korea (South Korea)"
replace stateid ="ROK" if country=="Republic of South Korea"
replace stateid ="ROK" if country=="Korea, South"
replace stateid ="ROK" if country=="Korea South"

replace stateid ="PRK" if country=="Korea, DPR"
replace stateid ="PRK" if country=="PRK"
replace stateid ="PRK" if country=="People's Republic of Korea"
replace stateid ="PRK" if country=="Korea North"

replace stateid ="AFG" if country=="Afghanistan"
replace stateid ="MAG" if country=="Madagasgar"
replace stateid ="MAG" if country=="Madagascar"
replace stateid ="MAG" if country=="Madagascar (Malagasy)"
replace stateid ="WSM" if country=="Western Samoa"

replace stateid ="CEN" if country=="Central African Rep."
replace stateid ="CEN" if country=="Cen African Rep"

replace stateid ="TAW" if country=="Chinese Taipei (Taiwan)"
replace stateid ="DRC" if country=="Congo Dem.Rep. (Zaire)"
replace stateid ="DRC" if country=="Congo Kinshasa"
replace stateid ="DRC" if country=="Congo - DRC"
replace stateid ="DRC" if country=="Congo, Democratic Republic of / Za"


replace stateid ="CON" if country=="Congo, Rep."
replace stateid ="CON" if country=="Congo, Republic of the"
replace stateid ="MAC" if country=="FYROM-Macedonia"
replace stateid ="MAC" if country=="Macedonia (FYROM)"
replace stateid ="MAC" if country=="Macedonia, Former Yugoslav Republic"
replace stateid ="KZK" if country=="Kazakstan"

replace stateid ="ROK" if country=="Korea"
replace stateid ="PRK" if country=="Korea, Dem. Rep."
replace stateid ="PRK" if country=="Korea, Democratic People's Rep (N)"

replace stateid ="KYR" if country=="Kyrgyz Rep."
replace stateid ="MYA" if country=="Myanmar (Burma)"
replace stateid ="STP" if country=="Sao Tome & Principe"
replace stateid ="SLO" if country=="Slovak Republic"
replace stateid ="SKN" if country=="St. Kitts-Nevis"
replace stateid ="SVG" if country=="St.Vincent&Grenadines"
replace stateid ="DRV" if country=="Viet Nam"
replace stateid ="SER" if country=="Serbia & Montenegro"
replace stateid ="SER" if country=="Serbia and Montenegro"
replace stateid ="SER" if country=="Republic of Serbia"
replace stateid ="SER" if country=="Serbia and Montenegro, Former"
*replace stateid ="SER" if country=="Serbia" & year>1993
replace stateid ="ETM" if country=="East Timor"
replace stateid = "DOM" if country=="Dominican Rep"
replace stateid = "DOM" if country=="Dominican Rep."
replace stateid ="GFR" if country=="Germany West"
replace stateid ="GFR" if country=="Germany, West"
replace stateid ="GFR" if country=="Federal Republic of Germany"

replace stateid ="GDR" if country=="Germany East"
replace stateid ="GDR" if country=="Germany, East"
replace stateid ="ETM" if country=="Timor-Leste"
replace stateid ="ETM" if country=="Timor Leste"
replace stateid = "KOS" if country=="Kosovo"
replace stateid = "SSD" if country=="South Sudan"
replace stateid = "MNG" if country=="Montenegro"

